import App from './App'
import request from './common/request';
import httpRequest from './common/httpRequest';
import emotion from './common/emotion.js';
import * as enums from './common/enums.js';
import * as date from './common/date';
import * as socketApi from './common/wssocket';
import * as messageType from './common/messageType';
import store from './store';

import messages from './locale/index'
let i18nConfig = {
	locale: uni.getLocale(),
	messages
}

import {
	createSSRApp
} from 'vue'
// #ifdef H5
import * as recorder from './common/recorder-h5';
// #endif
// #ifndef H5
import * as recorder from './common/recorder-app';
// #endif

import {
	createI18n
} from 'vue-i18n'
const i18n = createI18n(i18nConfig)


export function createApp() {
	const app = createSSRApp(App)
	app.use(store);
	app.config.globalProperties.$http = request;
	app.config.globalProperties.$httpRequest = httpRequest;
	app.config.globalProperties.$wsApi = socketApi;
	app.config.globalProperties.$msgType = messageType;
	app.config.globalProperties.$emo = emotion;
	app.config.globalProperties.$enums = enums;
	app.config.globalProperties.$date = date;
	app.config.globalProperties.$rc = recorder;
  app.use(i18n)
	return {
		app
	}
}